package com.bwie.redkids.adapter;

import java.util.ArrayList;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.bwie.redkids.R;
import com.bwie.redkids.bean.ClassifyBean.ClassifyCategoryBean;

public class ClassilyBaseAdapter extends BaseAdapter implements ListAdapter {

	private Context context;
	private ArrayList<ClassifyCategoryBean> arrayList;

	public ClassilyBaseAdapter(Context context,
			ArrayList<ClassifyCategoryBean> arrayList) {
		this.context = context;
		this.arrayList = arrayList;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return arrayList.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return arrayList.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@SuppressLint("ViewHolder")
	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		View view = View.inflate(context, R.layout.classify_item, null);
		TextView text1 = (TextView) view.findViewById(R.id.tv_classify);
		text1.setText(arrayList.get(arg0).getName());
		return view;
	}
}
